package com.only4play.practice.common.enums.pay;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.only4play.codegen.support.constants.BaseEnum;

import java.util.Optional;

/**
 * 任务批次状态枚举
 * @author mengdy
 */
public enum TaskBatchStatusEnum implements BaseEnum<TaskBatchStatusEnum> {

    NEW(0,"新建对账任务"),

    SUCCESS(2,"对账操作成功"),

    NO_BILL(3,"渠道没有账单信息"),

    FAIL(- 100,"对账任务执行异常"),
    // 对账文件下载失败
    DOWNLOAD_FILE_FAIL(- 101,"对账文件下载异常"),
    PARSER_FILE_FAIL(- 102,"对账文件解析异常"),


    ERROR(- 200,"渠道返回错误信息"),



    ;
    TaskBatchStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }
    @EnumValue
    private Integer code;
    private String name;


    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static Optional<TaskBatchStatusEnum> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(TaskBatchStatusEnum.class, code));
    }

    }
